#include <iostream>
#include <functional>
#include <exception>
#include <string>
#include <boost/filesystem.hpp>
#include <opencv2/opencv.hpp>

namespace fstr
{
    class Utils
    {
    public:
        static boost::filesystem::path getFullFilePath(
            const std::string& fileName, const std::string& subDir);

        static bool getAndCheckFullFilePath(const std::string& fileName,
            const std::string& subDir, boost::filesystem::path& path, std::string& msg);
        
        static std::string genTmpFileStemByTime();
        
        static bool genFullLogFileName(std::string& fileName, std::string& msg);

        static bool execWithEH(const std::function<bool()>& code, 
            const std::string& tag, std::string& msg);

        static std::string generateTag(const std::string& file,
            const std::string& function, int line);

        static bool isIntersected(cv::Rect2d ra, cv::Rect2d rb);
    };
}

#define GENERATE_TAG() fstr::Utils::generateTag(__FILE__, __func__, __LINE__)

